﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Microsoft.Msagl.Drawing;
using Microsoft.Msagl.GraphViewerGdi;
using System.Collections;

namespace PMisuseAn
{
    /// <summary>
    /// Interaction logic for ExpandedGraphWindow.xaml
    /// </summary>
    public partial class ExpandedGraphWindow : Window
    {

        Graph glee_fsm_graph;
        public ExpandedGraphWindow(Graph glee_fsm_graph_)
        {
            InitializeComponent();
            glee_fsm_graph = glee_fsm_graph_;
            displayExpandedGraph();
        }

        private void displayExpandedGraph()
        {
            //display graph
            GViewer viewer = new GViewer();
            Hashtable nodes = glee_fsm_graph.NodeMap;

            //change font size
            foreach (Edge node_f in glee_fsm_graph.Edges)
            {
                node_f.Label.FontSize = 16;
                node_f.Attr.ArrowheadLength = 20;
            }
            for (int i = 0; i <= glee_fsm_graph.NodeMap.Count + 1; i++)
            {
                foreach (DictionaryEntry entry in nodes)
                {
                    Node n = (Node)entry.Value;
                    n.Label.FontSize = 16;
                }

            }

            viewer.Graph = glee_fsm_graph;
            viewer.BackColor = System.Drawing.Color.White;
            viewer.Dock = System.Windows.Forms.DockStyle.Fill;

            this.fsm_wfh_expanded.Child = viewer;
        }
    }
}
